import React from "react";

import { Divider,Card } from 'antd';

import { ajax, openErrorNotification, openSuccessNotification, showResultMessage, isNotNull, isNull, inArray } from '../../common';

import UIActionBar from '../../uicomponents/UIActionBar';

import UIFormView from '../../uicomponents/UIFormView';

import UICardTabs from '../../uicomponents/UICardTabs'

import LessonListTable from './LessonListDataTablePanel.js';

/**
 * 班级学员编辑页面
 */
export default class ClassStudentConfigPanel extends React.Component{

    constructor(props) {
		super(props);
		this.state = {
			//selectedProuctVersion: null,
			activeTabKey : '',
		}
	}

	componentDidMount() {
		
	}

	onTabChange = (activeKey) => {
		
		if ('courseDefineListPanel' === activeKey) {
			this.courseDefineListRef.loadData();
		}
		else if('courseTypeListPanel' === activeKey){
			this.courseTypeListRef.loadData();
		}
		else if('courseItemListPanel' === activeKey){
			this.courseItemListRef.loadData();
		}

		//this.setState({activeTabKey : activeKey});
		if (this.props.onTabChanged) {
			this.props.onTabChanged(activeKey);
		}
	}

	render() {
        const {activeTabKey } = this.state;
        
        const classDefine = this.props.location.state.classDefine;

		const tabPanelContentMap = {

			'/normalStudentListPanel': {
				getComponent: (owner, props) => {
					return <NormalStudentListPanel {...props} history={this.props.pageHistory} ref={(inst) => this.courseDefineListRef = inst} key="CourseDefineListPanel" />;
				}
			},
			'/previewStudentListPanel': {
				getComponent: (owner, props) => {
					return <PreviewStudentListPanel {...props} history={this.props.pageHistory} ref={(inst) => this.courseTypeListRef = inst} key="CourseTypeListPanel" />;
				}
			},

		};

		return (
			<UICardTabs
                {...this.props}
				bordered={false}
				activeTabKey={this.props.activedTab}
				tabConfigId="ProductUI:classStudentManageTab"
				title="班级学员管理"
				onTabChange={this.onTabChange}
                tabContentMap={tabPanelContentMap}
                extra={<UIActionBar {...this.props} actionGroupId='goBackActionGroup' actionHandler={() => { }} />}
			/>
		);
	}
}

/**
 * 一般学员列表
 */
class NormalStudentListPanel extends React.Component {

    render(){
        return (<div/>);
    }
}

/**
 * 试听学员列表
 */
class PreviewStudentListPanel extends React.Component {

    render(){
        return (<div/>);
    }
}